/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.graphic.objects.addons;

import java.awt.geom.Line2D;
import java.io.Serializable;
import model.graphic.locations.Location;

/**
 *
 * @author Jelle
 */
public abstract class Addon implements IAddon, Serializable {

    protected Location center;
    protected Line2D l1 = new Line2D.Double();
    protected Line2D l2 = new Line2D.Double();
    private boolean addonHighlighted = false;

    public abstract void setCenter(Location center);

    public boolean inAddon(int x, int y) {
        return (x > l1.getX1() - 3 && x < l1.getX2() + 3 && y > l1.getY1() - 3 && y < l1.getY2() + 3);
    }

    public boolean isAddonHighlighted() {
        return addonHighlighted;
    }

    public void setAddonHighlighted(boolean highlighted) {
        addonHighlighted = highlighted;
    }

    /**
     * @return the l1
     */
    public Line2D getL1() {
        return l1;
    }

    /**
     * @return the l2
     */
    public Line2D getL2() {
        return l2;
    }
}
